package com.itheima.homework14;

public class Qu implements Runnable {
    @Override
    public void run() {
        while (true){
            synchronized (Store.obj) {
                if(Store.count<=0){
                    break;
                }
                else {
                    if(Store.count<=10){
                        System.out.println("消费取出"+(Store.count- Store.count+1)+"个单位货物"+"现在仓库剩余"+(Store.count-1));
                        Store.count--;
                        Store.obj.notifyAll();
                    }else {
                        try {
                            Store.obj.wait();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }


        }
    }
}
